//============================================================
// soundeffect.cpp
//
//============================================================
//#include "stdafx.h"
#include "soundeffect.h"


#include "soundmanager.h"
#include "resourcemanager.h"


namespace core
{
		
		void SoundEffect::LoadSound( const std::string& p_File )
		{
				if( m_Audio )
						m_Audio.reset();

				m_Audio = boost::dynamic_pointer_cast<Audio>( ResourceManager::GetInstance()->GetResource( p_File ) );
				if( !m_Audio )
				{
						m_Audio = AudioPtr( new Audio );
						m_Audio->LoadAudio( p_File, false );

						ResourceManager::GetInstance()->AddResource( p_File, m_Audio );
				}

		}

		void SoundEffect::Play( const Vector3& p_Position )
		{
				if( !m_Audio )
						return;

				SoundManager::GetInstance()->PlaySound( p_Position, m_Audio );
		}



};




